//
//  MHGLProtocolGroups.h
//  MiHome
//
//  Created by CoolKernel on 08/05/2017.
//  Copyright © 2017 小米移动软件. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <OpenGLES/ES2/gl.h>
#import <CoreVideo/CoreVideo.h>

@protocol MHGLProgramHandlerProtocol <NSObject>

@optional

//是否支持自定义shader
- (BOOL)supportCustomShader;

/**
 渲染需要设置参数

 @param lenCorrect （是否需要矫正， 矫正角度单位弧度，x边界，y边界，缩放）
 @param completion （x轴缩放， y轴缩放，x位移， y位移， 旋转角度弧度）
 */
- (void)deliverParametesLenCorrect:(void (^)(BOOL isUsedLenCorrect, float correctRadius, float osdx, float osdy, float zoom))lenCorrect
                 normalCompletion:(void (^)(float zoomX, float zoomY, float transitionX, float transitionY, float roattion))completion;

// 需要自定义shader
- (void)genFrameBuffer;
- (void)deleteFrameBuffer;

- (void)loadShader;

- (void)postTargetMainProgram:(GLuint)target;

- (void)deleteShader;
- (void)deleteProgram;

- (void)bindFrameBufferWithPreferredConversion:(const float *)preferredConversion;

- (void)loadTextureWithTextureCache:(CVOpenGLESTextureCacheRef)textureCache
                             buffer:(CVPixelBufferRef)pixelBuffer;
- (void)deleteTexture;

- (void)setCameraInfo:(NSData *)info;

@end

